import request from '@/utils/request'
// 查询所有分类
export const getAllCategory = () => {
  return request.get('/category')
}

// 分页查询所有分类
export const getAllCategoryPage = (page, pageSize, type, begin, end) => {
  return request.get('/category/page', {
    params: {
      page,
      pageSize,
      type,
      begin,
      end
    }
  })
}

// 删除分类
export const deleteCategoryById = (id) => {
  return request.delete('/category/' + id)
}

// 修改分类
export const updateCategoryById = (id, type) => {
  return request.put('/category', {
    id,
    type
  })
}

// 新增分类
export const addCategory = (type) => {
  return request.post('/category', {
    type
  })
}

// 根据id查询分类
export const getCategoryById = (id) => {
  return request.get('/category/' + id)
}
